﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using DTcms.DBUtility;
using DTcms.Common;

namespace DTcms.DAL
{
    /// <summary>
    /// 数据访问类:ch_stone_orders
    /// </summary>
    public partial class stone_orders
    {
		public stone_orders()
		{ }
        #region  BasicMethod

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(Guid id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from ch_stone_orders");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.UniqueIdentifier,16)          };
            parameters[0].Value = id;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.stone_orders model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into ch_stone_orders(");
            strSql.Append("id,orderNo,userId,userName,userPhone,payment_fee,payment_status,payment_time,express_no,express_fee,express_status,express_time,express_man,express_phone,accept_name,accept_phone,accept_time,province,city,district,address,post_code,remark,invoice_taxes,payable_amount,real_amount,order_amount,total_quantity,status,add_time,confirm_time,complete_time,extend1,extend2,extend3,extend4,extend5,extend6)");
            strSql.Append(" values (");
            strSql.Append("@id,@orderNo,@userId,@userName,@userPhone,@payment_fee,@payment_status,@payment_time,@express_no,@express_fee,@express_status,@express_time,@express_man,@express_phone,@accept_name,@accept_phone,@accept_time,@province,@city,@district,@address,@post_code,@remark,@invoice_taxes,@payable_amount,@real_amount,@order_amount,@total_quantity,@status,@add_time,@confirm_time,@complete_time,@extend1,@extend2,@extend3,@extend4,@extend5,@extend6)");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.UniqueIdentifier,16),
                    new SqlParameter("@orderNo", SqlDbType.NVarChar,50),
                    new SqlParameter("@userId", SqlDbType.Int,4),
                    new SqlParameter("@userName", SqlDbType.NVarChar,50),
                    new SqlParameter("@userPhone", SqlDbType.NVarChar,50),
                    new SqlParameter("@payment_fee", SqlDbType.Decimal,5),
                    new SqlParameter("@payment_status", SqlDbType.TinyInt,1),
                    new SqlParameter("@payment_time", SqlDbType.DateTime),
                    new SqlParameter("@express_no", SqlDbType.NVarChar,100),
                    new SqlParameter("@express_fee", SqlDbType.Decimal,5),
                    new SqlParameter("@express_status", SqlDbType.TinyInt,1),
                    new SqlParameter("@express_time", SqlDbType.DateTime),
                    new SqlParameter("@express_man", SqlDbType.NVarChar,100),
                    new SqlParameter("@express_phone", SqlDbType.NVarChar,50),
                    new SqlParameter("@accept_name", SqlDbType.NVarChar,50),
                    new SqlParameter("@accept_phone", SqlDbType.NVarChar,50),
                    new SqlParameter("@accept_time", SqlDbType.DateTime),
                    new SqlParameter("@province", SqlDbType.NVarChar,20),
                    new SqlParameter("@city", SqlDbType.NVarChar,20),
                    new SqlParameter("@district", SqlDbType.NVarChar,20),
                    new SqlParameter("@address", SqlDbType.NVarChar,255),
                    new SqlParameter("@post_code", SqlDbType.NVarChar,20),
                    new SqlParameter("@remark", SqlDbType.Text),
                    new SqlParameter("@invoice_taxes", SqlDbType.Decimal,5),
                    new SqlParameter("@payable_amount", SqlDbType.Decimal,5),
                    new SqlParameter("@real_amount", SqlDbType.Decimal,5),
                    new SqlParameter("@order_amount", SqlDbType.Decimal,5),
                    new SqlParameter("@total_quantity", SqlDbType.Int,4),
                    new SqlParameter("@status", SqlDbType.TinyInt,1),
                    new SqlParameter("@add_time", SqlDbType.DateTime),
                    new SqlParameter("@confirm_time", SqlDbType.DateTime),
                    new SqlParameter("@complete_time", SqlDbType.DateTime),
                    new SqlParameter("@extend1", SqlDbType.Decimal,5),
                    new SqlParameter("@extend2", SqlDbType.Decimal,5),
                    new SqlParameter("@extend3", SqlDbType.NVarChar,50),
                    new SqlParameter("@extend4", SqlDbType.NVarChar,50),
                    new SqlParameter("@extend5", SqlDbType.NVarChar,50),
                    new SqlParameter("@extend6", SqlDbType.NVarChar,50)};
            parameters[0].Value = Guid.NewGuid();
            parameters[1].Value = model.orderNo;
            parameters[2].Value = model.userId;
            parameters[3].Value = model.userName;
            parameters[4].Value = model.userPhone;
            parameters[5].Value = model.payment_fee;
            parameters[6].Value = model.payment_status;
            parameters[7].Value = model.payment_time;
            parameters[8].Value = model.express_no;
            parameters[9].Value = model.express_fee;
            parameters[10].Value = model.express_status;
            parameters[11].Value = model.express_time;
            parameters[12].Value = model.express_man;
            parameters[13].Value = model.express_phone;
            parameters[14].Value = model.accept_name;
            parameters[15].Value = model.accept_phone;
            parameters[16].Value = model.accept_time;
            parameters[17].Value = model.province;
            parameters[18].Value = model.city;
            parameters[19].Value = model.district;
            parameters[20].Value = model.address;
            parameters[21].Value = model.post_code;
            parameters[22].Value = model.remark;
            parameters[23].Value = model.invoice_taxes;
            parameters[24].Value = model.payable_amount;
            parameters[25].Value = model.real_amount;
            parameters[26].Value = model.order_amount;
            parameters[27].Value = model.total_quantity;
            parameters[28].Value = model.status;
            parameters[29].Value = model.add_time;
            parameters[30].Value = model.confirm_time;
            parameters[31].Value = model.complete_time;
            parameters[32].Value = model.extend1;
            parameters[33].Value = model.extend2;
            parameters[34].Value = model.extend3;
            parameters[35].Value = model.extend4;
            parameters[36].Value = model.extend5;
            parameters[37].Value = model.extend6;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.stone_orders model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update ch_stone_orders set ");
            strSql.Append("orderNo=@orderNo,");
            strSql.Append("userId=@userId,");
            strSql.Append("userName=@userName,");
            strSql.Append("userPhone=@userPhone,");
            strSql.Append("payment_fee=@payment_fee,");
            strSql.Append("payment_status=@payment_status,");
            strSql.Append("payment_time=@payment_time,");
            strSql.Append("express_no=@express_no,");
            strSql.Append("express_fee=@express_fee,");
            strSql.Append("express_status=@express_status,");
            strSql.Append("express_time=@express_time,");
            strSql.Append("express_man=@express_man,");
            strSql.Append("express_phone=@express_phone,");
            strSql.Append("accept_name=@accept_name,");
            strSql.Append("accept_phone=@accept_phone,");
            strSql.Append("accept_time=@accept_time,");
            strSql.Append("province=@province,");
            strSql.Append("city=@city,");
            strSql.Append("district=@district,");
            strSql.Append("address=@address,");
            strSql.Append("post_code=@post_code,");
            strSql.Append("remark=@remark,");
            strSql.Append("invoice_taxes=@invoice_taxes,");
            strSql.Append("payable_amount=@payable_amount,");
            strSql.Append("real_amount=@real_amount,");
            strSql.Append("order_amount=@order_amount,");
            strSql.Append("total_quantity=@total_quantity,");
            strSql.Append("status=@status,");
            strSql.Append("add_time=@add_time,");
            strSql.Append("confirm_time=@confirm_time,");
            strSql.Append("complete_time=@complete_time,");
            strSql.Append("extend1=@extend1,");
            strSql.Append("extend2=@extend2,");
            strSql.Append("extend3=@extend3,");
            strSql.Append("extend4=@extend4,");
            strSql.Append("extend5=@extend5,");
            strSql.Append("extend6=@extend6");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@orderNo", SqlDbType.NVarChar,50),
                    new SqlParameter("@userId", SqlDbType.Int,4),
                    new SqlParameter("@userName", SqlDbType.NVarChar,50),
                    new SqlParameter("@userPhone", SqlDbType.NVarChar,50),
                    new SqlParameter("@payment_fee", SqlDbType.Decimal,5),
                    new SqlParameter("@payment_status", SqlDbType.TinyInt,1),
                    new SqlParameter("@payment_time", SqlDbType.DateTime),
                    new SqlParameter("@express_no", SqlDbType.NVarChar,100),
                    new SqlParameter("@express_fee", SqlDbType.Decimal,5),
                    new SqlParameter("@express_status", SqlDbType.TinyInt,1),
                    new SqlParameter("@express_time", SqlDbType.DateTime),
                    new SqlParameter("@express_man", SqlDbType.NVarChar,100),
                    new SqlParameter("@express_phone", SqlDbType.NVarChar,50),
                    new SqlParameter("@accept_name", SqlDbType.NVarChar,50),
                    new SqlParameter("@accept_phone", SqlDbType.NVarChar,50),
                    new SqlParameter("@accept_time", SqlDbType.DateTime),
                    new SqlParameter("@province", SqlDbType.NVarChar,20),
                    new SqlParameter("@city", SqlDbType.NVarChar,20),
                    new SqlParameter("@district", SqlDbType.NVarChar,20),
                    new SqlParameter("@address", SqlDbType.NVarChar,255),
                    new SqlParameter("@post_code", SqlDbType.NVarChar,20),
                    new SqlParameter("@remark", SqlDbType.Text),
                    new SqlParameter("@invoice_taxes", SqlDbType.Decimal,5),
                    new SqlParameter("@payable_amount", SqlDbType.Decimal,5),
                    new SqlParameter("@real_amount", SqlDbType.Decimal,5),
                    new SqlParameter("@order_amount", SqlDbType.Decimal,5),
                    new SqlParameter("@total_quantity", SqlDbType.Int,4),
                    new SqlParameter("@status", SqlDbType.TinyInt,1),
                    new SqlParameter("@add_time", SqlDbType.DateTime),
                    new SqlParameter("@confirm_time", SqlDbType.DateTime),
                    new SqlParameter("@complete_time", SqlDbType.DateTime),
                    new SqlParameter("@extend1", SqlDbType.Decimal,5),
                    new SqlParameter("@extend2", SqlDbType.Decimal,5),
                    new SqlParameter("@extend3", SqlDbType.NVarChar,50),
                    new SqlParameter("@extend4", SqlDbType.NVarChar,50),
                    new SqlParameter("@extend5", SqlDbType.NVarChar,50),
                    new SqlParameter("@extend6", SqlDbType.NVarChar,50),
                    new SqlParameter("@id", SqlDbType.UniqueIdentifier,16)};
            parameters[0].Value = model.orderNo;
            parameters[1].Value = model.userId;
            parameters[2].Value = model.userName;
            parameters[3].Value = model.userPhone;
            parameters[4].Value = model.payment_fee;
            parameters[5].Value = model.payment_status;
            parameters[6].Value = model.payment_time;
            parameters[7].Value = model.express_no;
            parameters[8].Value = model.express_fee;
            parameters[9].Value = model.express_status;
            parameters[10].Value = model.express_time;
            parameters[11].Value = model.express_man;
            parameters[12].Value = model.express_phone;
            parameters[13].Value = model.accept_name;
            parameters[14].Value = model.accept_phone;
            parameters[15].Value = model.accept_time;
            parameters[16].Value = model.province;
            parameters[17].Value = model.city;
            parameters[18].Value = model.district;
            parameters[19].Value = model.address;
            parameters[20].Value = model.post_code;
            parameters[21].Value = model.remark;
            parameters[22].Value = model.invoice_taxes;
            parameters[23].Value = model.payable_amount;
            parameters[24].Value = model.real_amount;
            parameters[25].Value = model.order_amount;
            parameters[26].Value = model.total_quantity;
            parameters[27].Value = model.status;
            parameters[28].Value = model.add_time;
            parameters[29].Value = model.confirm_time;
            parameters[30].Value = model.complete_time;
            parameters[31].Value = model.extend1;
            parameters[32].Value = model.extend2;
            parameters[33].Value = model.extend3;
            parameters[34].Value = model.extend4;
            parameters[35].Value = model.extend5;
            parameters[36].Value = model.extend6;
            parameters[37].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(Guid id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from ch_stone_orders ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.UniqueIdentifier,16)          };
            parameters[0].Value = id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string idlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from ch_stone_orders ");
            strSql.Append(" where id in (" + idlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.stone_orders GetModel(Guid id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,orderNo,userId,userName,userPhone,payment_fee,payment_status,payment_time,express_no,express_fee,express_status,express_time,express_man,express_phone,accept_name,accept_phone,accept_time,province,city,district,address,post_code,remark,invoice_taxes,payable_amount,real_amount,order_amount,total_quantity,status,add_time,confirm_time,complete_time,extend1,extend2,extend3,extend4,extend5,extend6 from ch_stone_orders ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.UniqueIdentifier,16)          };
            parameters[0].Value = id;

            Model.stone_orders model = new Model.stone_orders();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.stone_orders GetModel(string orderNo)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,orderNo,userId,userName,userPhone,payment_fee,payment_status,payment_time,express_no,express_fee,express_status,express_time,express_man,express_phone,accept_name,accept_phone,accept_time,province,city,district,address,post_code,remark,invoice_taxes,payable_amount,real_amount,order_amount,total_quantity,status,add_time,confirm_time,complete_time,extend1,extend2,extend3,extend4,extend5,extend6 from ch_stone_orders ");
            strSql.Append(" where orderNo=@orderNo ");
            SqlParameter[] parameters = {
                    new SqlParameter("@orderNo", SqlDbType.NVarChar,100)          };
            parameters[0].Value = orderNo;

            Model.stone_orders model = new Model.stone_orders();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.stone_orders DataRowToModel(DataRow row)
        {
            Model.stone_orders model = new Model.stone_orders();
            if (row != null)
            {
                if (row["id"] != null && row["id"].ToString() != "")
                {
                    model.id = new Guid(row["id"].ToString());
                }
                if (row["orderNo"] != null)
                {
                    model.orderNo = row["orderNo"].ToString();
                }
                if (row["userId"] != null && row["userId"].ToString() != "")
                {
                    model.userId = int.Parse(row["userId"].ToString());
                }
                if (row["userName"] != null)
                {
                    model.userName = row["userName"].ToString();
                }
                if (row["userPhone"] != null)
                {
                    model.userPhone = row["userPhone"].ToString();
                }
                if (row["payment_fee"] != null && row["payment_fee"].ToString() != "")
                {
                    model.payment_fee = decimal.Parse(row["payment_fee"].ToString());
                }
                if (row["payment_status"] != null && row["payment_status"].ToString() != "")
                {
                    model.payment_status = int.Parse(row["payment_status"].ToString());
                }
                if (row["payment_time"] != null && row["payment_time"].ToString() != "")
                {
                    model.payment_time = DateTime.Parse(row["payment_time"].ToString());
                }
                if (row["express_no"] != null)
                {
                    model.express_no = row["express_no"].ToString();
                }
                if (row["express_fee"] != null && row["express_fee"].ToString() != "")
                {
                    model.express_fee = decimal.Parse(row["express_fee"].ToString());
                }
                if (row["express_status"] != null && row["express_status"].ToString() != "")
                {
                    model.express_status = int.Parse(row["express_status"].ToString());
                }
                if (row["express_time"] != null && row["express_time"].ToString() != "")
                {
                    model.express_time = DateTime.Parse(row["express_time"].ToString());
                }
                if (row["express_man"] != null)
                {
                    model.express_man = row["express_man"].ToString();
                }
                if (row["express_phone"] != null)
                {
                    model.express_phone = row["express_phone"].ToString();
                }
                if (row["accept_name"] != null)
                {
                    model.accept_name = row["accept_name"].ToString();
                }
                if (row["accept_phone"] != null)
                {
                    model.accept_phone = row["accept_phone"].ToString();
                }
                if (row["accept_time"] != null && row["accept_time"].ToString() != "")
                {
                    model.accept_time = DateTime.Parse(row["accept_time"].ToString());
                }
                if (row["province"] != null)
                {
                    model.province = row["province"].ToString();
                }
                if (row["city"] != null)
                {
                    model.city = row["city"].ToString();
                }
                if (row["district"] != null)
                {
                    model.district = row["district"].ToString();
                }
                if (row["address"] != null)
                {
                    model.address = row["address"].ToString();
                }
                if (row["post_code"] != null)
                {
                    model.post_code = row["post_code"].ToString();
                }
                if (row["remark"] != null)
                {
                    model.remark = row["remark"].ToString();
                }
                if (row["invoice_taxes"] != null && row["invoice_taxes"].ToString() != "")
                {
                    model.invoice_taxes = decimal.Parse(row["invoice_taxes"].ToString());
                }
                if (row["payable_amount"] != null && row["payable_amount"].ToString() != "")
                {
                    model.payable_amount = decimal.Parse(row["payable_amount"].ToString());
                }
                if (row["real_amount"] != null && row["real_amount"].ToString() != "")
                {
                    model.real_amount = decimal.Parse(row["real_amount"].ToString());
                }
                if (row["order_amount"] != null && row["order_amount"].ToString() != "")
                {
                    model.order_amount = decimal.Parse(row["order_amount"].ToString());
                }
                if (row["total_quantity"] != null && row["total_quantity"].ToString() != "")
                {
                    model.total_quantity = int.Parse(row["total_quantity"].ToString());
                }
                if (row["status"] != null && row["status"].ToString() != "")
                {
                    model.status = int.Parse(row["status"].ToString());
                }
                if (row["add_time"] != null && row["add_time"].ToString() != "")
                {
                    model.add_time = DateTime.Parse(row["add_time"].ToString());
                }
                if (row["confirm_time"] != null && row["confirm_time"].ToString() != "")
                {
                    model.confirm_time = DateTime.Parse(row["confirm_time"].ToString());
                }
                if (row["complete_time"] != null && row["complete_time"].ToString() != "")
                {
                    model.complete_time = DateTime.Parse(row["complete_time"].ToString());
                }
                if (row["extend1"] != null && row["extend1"].ToString() != "")
                {
                    model.extend1 = decimal.Parse(row["extend1"].ToString());
                }
                if (row["extend2"] != null && row["extend2"].ToString() != "")
                {
                    model.extend2 = decimal.Parse(row["extend2"].ToString());
                }
                if (row["extend3"] != null)
                {
                    model.extend3 = row["extend3"].ToString();
                }
                if (row["extend4"] != null)
                {
                    model.extend4 = row["extend4"].ToString();
                }
                if (row["extend5"] != null)
                {
                    model.extend5 = row["extend5"].ToString();
                }
                if (row["extend6"] != null)
                {
                    model.extend6 = row["extend6"].ToString();
                }
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select id,orderNo,userId,userName,userPhone,payment_fee,payment_status,payment_time,express_no,express_fee,express_status,express_time,express_man,express_phone,accept_name,accept_phone,accept_time,province,city,district,address,post_code,remark,invoice_taxes,payable_amount,real_amount,order_amount,total_quantity,status,add_time,confirm_time,complete_time,extend1,extend2,extend3,extend4,extend5,extend6 ");
            strSql.Append(" FROM ch_stone_orders ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" id,orderNo,userId,userName,userPhone,payment_fee,payment_status,payment_time,express_no,express_fee,express_status,express_time,express_man,express_phone,accept_name,accept_phone,accept_time,province,city,district,address,post_code,remark,invoice_taxes,payable_amount,real_amount,order_amount,total_quantity,status,add_time,confirm_time,complete_time,extend1,extend2,extend3,extend4,extend5,extend6 ");
            strSql.Append(" FROM ch_stone_orders ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }
        /// <summary>
        /// 获得查询分页数据
        /// </summary>
        public DataSet GetList(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * FROM  ch_stone_orders ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            //recordCount = Convert.ToInt32(DbHelperSQL.GetSingle(PagingHelper.CreateCountingSql(strSql.ToString())));
            recordCount = GetRecordCount(strWhere);
            return DbHelperSQL.Query(PagingHelper.CreatePagingSql(recordCount, pageSize, pageIndex, strSql.ToString(), filedOrder));
        }

        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            try {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("select count(1) FROM ch_stone_orders ");
                if (strWhere.Trim() != "")
                {
                    strSql.Append(" where " + strWhere);
                }
                object obj = DbHelperSQL.GetSingle(strSql.ToString());
                if (obj == null)
                {
                    return 0;
                }
                else
                {
                    return Convert.ToInt32(obj);
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message);
            }
          
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.id desc");
            }
            strSql.Append(")AS Row, T.*  from ch_stone_orders T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "ch_stone_orders";
			parameters[1].Value = "id";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/

        #endregion  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod


    }
}
